/*
 * @Description: 检索利用 - 接收相关接口
 * @Author: Rfan
 * @Date: 2022-11-23 11:27:41
 * @LastEditTime: 2022-11-24 17:09:18
 */

import request from '@/utils/request';
import { Key } from 'react';
import { IPageQuery } from '@/interfaces/global';
import { IAddPlanParams } from '@/api/standardizedDetection/detectionPlan';

export interface IRegRetrieveUseListParams {
  archiveTypeId?: number;
  archiveTypeName?: string;
  createTime?: string;
  deptName?: string;
  efileCount?: number;
  fileCount?: number;
  folderCount?: number;
  fondsId?: number;
  fondsName?: string;
  fondsNo?: string;
  id?: number;
  operator?: number;
  operatorName?: string;
  operatorTime?: string;
  registrant?: string;
  registrationTime?: string;
  remark?: string;
  retrieveCount?: number;
  retrievePersonName?: string;
  retrieveTime?: string;
  roleType?: string;
  unitName?: string;
  userId?: number;
}

// 分页查询移交登记列表
export function fetchRegRetrieveUseListByPage(data: IPageQuery<IRegRetrieveUseListParams>) {
  return request({
    url: `/register-retrieve-use/page`,
    method: 'post',
    data
  });
}

export interface IAddRegRetrieveUseParams {
  archiveTypeId?: number;
  deptName?: string;
  efileCount?: number;
  fileCount?: number;
  folderCount?: number;
  fondsId?: number;
  registrant?: string;
  registrationTime?: string;
  remark?: string;
  retrieveCount?: number;
  retrievePersonName?: string;
  retrieveTime?: string;
  roleType?: string;
  unitName?: string;
  userId?: number;
}

// 添加移交登记条目
export function addRegRetrieveUse(data: IAddRegRetrieveUseParams) {
  return request({
    url: `/register-retrieve-use/`,
    method: 'post',
    data
  });
}

export interface IEditRegRetrieveUseParams extends IAddRegRetrieveUseParams {
  id: number;
}
// 编辑移交登记条目
export function editRegRetrieveUse(data: IEditRegRetrieveUseParams) {
  return request({
    url: `/register-retrieve-use`,
    method: 'put',
    data
  });
}

// 删除移交登记条目
export function deleteRegRetrieveUseItem(id: Key) {
  return request({
    url: `/register-retrieve-use/${id}`,
    method: 'delete'
  });
}
